<?php // I know the syntax is probably wrong, or not optimised, but I'm still learning >_>" #Tom

//Set up MySQL connection so procedures can be called
$dbase = new mysqli('localhost', 'root', 'password', 'sourcedrop');


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head>
<link rel='StyleSheet' HREF="CSS.css" TYPE="text/css">
	<title>//SourceDrop</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>

<body>

<div id='header'>

    <p>Fillertext</p>

</div>



<div id='body'>

    <p>Fillertext2</p>
	<br />
	
	<!--Form. Submits form box data as $_POST['formInput']-->
	<form target='index_v1.php' method="post">
	Submit:<input type="text" name="formInput" /><input type="submit" />
	</form>

</div>



<div id='return'>

<?php
//Set the form data return to a variable(assign $_POST[array] to variable), 
//otherwise errors occur in MySQL->query INSERT. It doesn't like being passed $_POST arrays.
if(!empty($_POST['formInput'])){
$postcheck = $_POST['formInput'];
}
else
echo "_POST['formInput'] is empty, and so is postcheck";

//Meant to return error in some cases, just a test for myself to see how it functioned.
echo "<br /><br />";

//If $postcheck variable has the data we set in it, preform actions.
if(isset($postcheck) && $postcheck !=""){
		//insert $POST[formInput] into database at next primary key index.
		$dbase->query("INSERT INTO myTable VALUES ('', '$postcheck')") or die($dbase->error);
	}

echo "<br /> <br />";

//Get all primary indexes and associated data(text)
$result = $dbase->query('SELECT * FROM myTable') or die($mysql->error);

//While there's a row to read, read it and set $row to it.
while($row = $result->fetch_object()){

//Echo database current row 'id' column
echo $row->id;
echo " ";

//Echo database current row 'data' column
echo $row->data;
echo "<br />";
}

?>

</div>

</body>

</html>